package com.ims.service.impl;

import com.ims.dao.DaoSupport;
import com.ims.entity.Page;
import com.ims.entity.system.Course;
import com.ims.service.CourseMapper;
import com.ims.util.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CourseServiceImpl implements CourseMapper{


    @Resource(name = "daoSupport")
    private DaoSupport dao;

    @Override
    public int deleteByPrimaryKey(Integer cId) throws Exception{
        return  (Integer) dao.delete("CourseMapper.deleteByPrimaryKey",cId);


    }

    @Override
    public int insert(Course record) throws Exception {

        return (Integer) dao.save("CourseMapper.insert",record);

    }

    @Override
    public int insertSelective(Course record) {
        return 0;
    }

    @Override
    public Course selectByPrimaryKey(Integer cId) {
        return  (Course)dao.findForObject("CourseMapper.selectByPrimaryKey",cId);

    }

    @Override
    public int updateByPrimaryKeySelective(Course record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(Course record) throws Exception{


        return  (Integer) dao.update("CourseMapper.updateByPrimaryKey",record);
    }

    @Override
    public List<PageData> listAllCourse(Page page) throws Exception{
        return (List<PageData>)dao.findForList("CourseMapper.listAllCourse",page);
    }
}
